<?php

class Action_Community_ShowIssue extends RL_Handler
{

	public function process ()
	{
		$this->rh->UseClass('RL_CyrDate');
		$aa = $this->module->aa;
		$this->data = $data = $aa->getInfo();

		// проверка прав
		$aa->getAvailableOperations();
		if ( !$aa->is_granted( array( 'item_read') ) ) { echo "access denied"; return false; }

		// прицепим необходимую модель данных
		$this->ctx->mm->setAclAssistant( $aa );
		$this->m_item = $this->ctx->mm->getModel("Issue", "m");

		$aa->checkDeletions( array($this, "shutdown") );

		$_result = $this->m_item->getOneIssue( $this->params['id_item'] );
		$_result['issue']['acl'] = $aa->getAcl( $issue_oid );

		$view = $this->rh->views->findByName('issue');

		// назначаем шаблонные переменные
		$view->data = $aa->template_data;

		$view->data['can_create'] = $aa->is_granted(array('item_create', 'item_create_premod'));

		$view->data['rubrics'] = $_result['rubrics'];
		$view->data['issue'] = $_result['issue'];

		$view->data['hide_comments_block'] = 1;
		$view->data['hide_form'] = 1;

		$view->data['item_oid'] = $item['post']['oid'];
		$view->data['community_id'] = $data['community_id'];

		$this->rh->response->setContent( $view );

		// -- touch visitor stat -- {{{
		// visit  tdi
		$this->ctx->mm->getModel("Visitable", "m")->getVisitable('Item')->setWhat($item['post']['oid'])->visit();
		//
		// -- touch visitor stat -- }}}

	} // end of function execute

}
